<?php
/**
 * Created by PhpStorm.
 * User: RagPanda
 * Date: 2016/3/9
 * Time: 14:23
 */

namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use MyClass\Base\GuiFunction;
use MyClass\Serve\Request;
use MyClass\Serve\Tax;


class TenementController extends Controller
{
    public function __construct(GuiFunction $guiFunc)
    {
        $guiFunc->setModule("Tenement");
        //dump(session("other"));

    }
    public function index(GuiFunction $guiFunc)
    {

        return view("Admin.Tenement.index");

    }
    public function sRequest()
    {
        return view("Admin.Tenement.sRequest");
    }
    public function sTax()
    {
        return view("Admin.Tenement.sTax");
    }

    //request基类接口测试
    public function aRest()
    {
        $dataArray['request_user'] = 1;
        $dataArray['request_class'] = 7;
        if(Request::add($dataArray))
        {
            echo "cg";
        }
        else
        {
            echo "sb";
        }
    }

    public function sRest()
    {
        $queryLimit['start'] = 0;
        $queryLimit['num'] = 5;
        $queryLimit['class'] = 7;
        $queryLimit['paginate'] = 3;
        $queryLimit['desc'] = true;
        $queryLimit['user'] = 1;

        $data = Request::select($queryLimit);
        dump($data);
    }

    public function uRest()
    {
        $request = new Request(1);
        $dataArray['request_user_intro'] = "bu hao";
        if($request->update($dataArray))
        {
            echo "cg";
        }
        else
        {
            echo "sb";
        }
    }

    public function dRest()
    {
        $request = new Request(24);
        if($request->delete())
        {
            echo "cg";
        }
        else
        {
            echo "sb";
        }
    }

    //tax基类接口测试
    public function aTx()
    {
        $dataArray['tax_class'] = 10;
        $dataArray['tax_intro'] = "缴费介绍";
        $dataArray['tax_user'] = 1;
        if(Tax::add($dataArray))
        {
            echo "cg";
        }
        else
        {
            echo "sb";
        }
    }

    public function sTx()
    {
        //$queryLimit['start'] = 0;
        //$queryLimit['num'] = 5;
        //$queryLimit['class'] = 14;
        $queryLimit['paginate'] = 3;
        //$queryLimit['desc'] = true;
        //$queryLimit['user'] = 1;
        //$queryLimit['id'] = 5;

        $data = Tax::select($queryLimit);
        dump($data);
    }

    public function uTx()
    {
        $tax = new Tax(1);
        $dataArray['tax_intro'] = "缴费的介绍哦！";
        if($tax->update($dataArray))
        {
            echo "cg";
        }
        else
        {
            echo "sb";
        }
    }

    public function dTx()
    {
        $tax = new Tax(17);
        if($tax->delete())
        {
            echo "cg";
        }
        else
        {
            echo "sb";
        }
    }

}